package presenter.rename;

import main.InputBean;
import main.InputMode;
import utils.FileBean;
import utils.TextUtils;

import java.util.Map;

public enum RenameType implements IReNamer {
    GoPro(InputMode.GoPro.tag, new GoProRecorderImpl()),
    Recorder(InputMode.Recorder.tag, new ScreenRecorderImpl()),
    Cus(InputMode.Custom.tag, new CusRenamerImpl());

    private final IReNamer renamer;
    private final String tag;

    RenameType(String tag, IReNamer renamer) {
        this.tag = tag;
        this.renamer = renamer;
    }

    @Override
    public boolean needReName(InputBean info, FileBean bean) {
        return renamer.needReName(info, bean);
    }

    @Override
    public void reName(InputBean info, FileBean bean, Map<String, String> container) {
        renamer.reName(info, bean, container);
    }

    public static RenameType parse(String tag) {
        for (RenameType type : RenameType.values()) {
            if (TextUtils.equals(type.tag, tag)) {
                return type;
            }
        }
        return GoPro;
    }
}
